package com.think.teaching.mapper;

import com.think.teaching.model.College;
import com.think.teaching.model.Major;

import java.util.List;

import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 * 院系 Mapper 接口
 * </p>
 *
 * @author think
 * @since 2020-08-12
 */
public interface CollegeMapper extends BaseMapper<College> {
	
	@Select("SELECT id,school,college_name FROM college WHERE id=#{college}")
	@Result(column="school",property="schoolInfo",one = @One(select = "com.think.teaching.mapper.SchoolMapper.getInfoById",fetchType = FetchType.EAGER))
	College getInfoById(Integer college);
	
	@Select("SELECT * FROM major WHERE college=#{college} AND delflag=0 AND state=1")
	List<Major> getCollegeMajorsById(Integer college);
	
	
}
